package com.ossfk.net.config;

import java.net.InetSocketAddress;

import com.ossfk.net.client.AbstractTcpClient;

import lombok.Data;

/**
 * 
 * @ClassName: NetClientConfig
 * @Description: 客户端配置
 * @author Liujiefu
 * @date 2020-03-13 16:07:45
 */
@Data
public class NetClientConfig {
	/**
	 * 默认端口
	 */
	public static final int DEFULT_PORT = 8000;

	/**
	 * socket地址及端口
	 */
	private InetSocketAddress socketAddress;
	/**
	 * 是否保持连接，默认保持连接
	 */
	private boolean keepAlive = true;
	/**
	 * 读取消息闲置时间默认60秒
	 */
	private long readerIdleTimeSeconds = 60;
	/**
	 * 客户端名称
	 */
	private String name="TcpClient";
	/**
	 * 自动连接
	 */
	private boolean autoConnect = false;
	/**
	 * 自动重连间隔
	 */
	private Long autoConnectSeconds;
	/** 手机号码 */
	private String phoneNum;
	/** 设备id */
	private String devid;
	/** tcp客户端 */
	private AbstractTcpClient client;

	public NetClientConfig() {
		this.socketAddress = new InetSocketAddress(DEFULT_PORT);
	}

	public NetClientConfig(String host, int port) {
		this.socketAddress = new InetSocketAddress(host, port);
	}

	public NetClientConfig(InetSocketAddress socketAddress) {
		if (socketAddress == null)
			throw new IllegalArgumentException("socketAddress can't be null");
		this.socketAddress = socketAddress;
	}

}
